package com.codingapi.mybatisdemo2.service.impl;


import com.codingapi.mybatisdemo2.client.TestClient;
import com.codingapi.mybatisdemo2.dao.TestMapper;
import com.codingapi.mybatisdemo2.entity.Test;
import com.codingapi.mybatisdemo2.service.DemoService;
import com.codingapi.tx.annotation.TxTransaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by lorne on 2017/6/26.
 */
@Service
public class DemoServiceImpl implements DemoService{

    @Autowired
    private TestMapper testMapper;
     @Autowired
    private TestClient testClient;
    @Override
    @TxTransaction(isStart = true)
    @Transactional
    public int save(Test test) {
        int i = testClient.save();
        test.setName("a");
        testMapper.save(test);
        return i;
    }
}
